package com.wms.web.controller.wcs;

import com.wms.common.core.controller.BaseController;
import com.wms.common.core.domain.AjaxResult;
import com.wms.common.core.page.TableDataInfo;
import com.wms.system.domain.wcs.PackingListSon;
import com.wms.system.domain.wcs.ProjectInventory;
import com.wms.system.service.wcs.IPackingListSonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "订单管理-子级订单")
@RestController
@RequestMapping("/wcs/packingListSon")
public class PackingListSonController extends BaseController {
    @Autowired
    private IPackingListSonService packingListSonService;

    /**
     * 获取项目看板信息列表
     */
    @ApiOperation("获取子级订单列表")
    @GetMapping("/list")
    public TableDataInfo list(PackingListSon packingListSon) {
        startPage();
        List<PackingListSon> list = packingListSonService.queryListByOrderCode(packingListSon.getOrderCode());
        return getDataTable(list);
    }


    @ApiOperation("子级订单详情")
    @PostMapping("/detail")
    public AjaxResult detail(@RequestBody PackingListSon packingListSon) {
        return AjaxResult.success(packingListSonService.detail(packingListSon));
    }


    /**
     * 新增子级订单信息
     */
    @PostMapping(value = "/add")
    @ApiOperation("新增子级订单信息")
    public AjaxResult add(@RequestBody PackingListSon packingListSon) {
        packingListSonService.insert(packingListSon);
        return AjaxResult.success();
    }

    /**
     * 修改子级订单
     */
    @ApiOperation("修改子级订单信息")
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody PackingListSon packingListSon) {
        packingListSonService.update(packingListSon);
        return AjaxResult.success();
    }


    /**
     * 批量删除
     */
    @ApiOperation("批量删除子级订单信息")
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        packingListSonService.delete(ids);
        return AjaxResult.success();
    }
}
